package com.ardf.service;

import jakarta.websocket.Session;
import jakarta.websocket.server.PathParam;

import java.util.Set;

public interface CardWebSocketService {
    /**
     * 开始连接
     * @param session
     * @param uid
     */
    public void onOpen(Session session, @PathParam(value="uid") Long uid);

    /**
     * 关闭连接
     * @param session
     * @param uid
     */
    public void onClose(Session session, @PathParam(value="uid") Long uid);

    /**
     * 收到客户端消息
     * @param session
     * @param uid
     * @param message
     */
    public void onMessage(Session session, @PathParam(value="uid") Long uid,String message);

    /**
     * 发送错误
     * @param session
     * @param uid
     * @param e
     */
    public void onError(Session session,@PathParam(value="uid") Long uid,Throwable e);

    /**
     * 广播消息
     * @param message
     */
    public void sendAllMessage(String message);

    /**
     * 多个消息发送
     * @param uids
     * @param message
     */
    public void sendMessageToUsers(Set<Long> uids, String message);

    /**
     * 单个消息发送
     * @param uid
     * @param message
     */
    public void sendMessageToUser(Long uid, String message);

}
